package cn.cs.service;

import cn.cs.mapper.CsAreaMapper;
import cn.cs.pojo.CsArea;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
 * yuexl
 */
@RestController
public class RestCsAreaService {

     //@Autowired
     @Resource
     private CsAreaMapper csAreaMapper;

     @RequestMapping(value = "/getCsAreaById",method = RequestMethod.POST)
     public CsArea getCsAreaById(@RequestParam("id") Long id)throws Exception{
        return csAreaMapper.getCsAreaById(id);
     }

     @RequestMapping(value = "/getCsAreaListByMap",method = RequestMethod.POST)
     public List<CsArea>	getCsAreaListByMap(@RequestBody Map<String,Object> param)throws Exception{
        return csAreaMapper.getCsAreaListByMap(param);
     }

     @RequestMapping(value = "/getCsAreaCountByMap",method = RequestMethod.POST)
     public Integer getCsAreaCountByMap(@RequestBody Map<String,Object> param)throws Exception{
        return csAreaMapper.getCsAreaCountByMap(param);
     }

     @RequestMapping(value = "/qdtxAddCsArea",method = RequestMethod.POST)
     public Integer qdtxAddCsArea(@RequestBody CsArea csArea)throws Exception{
        csArea.setCreatedTime(new Date());
        return csAreaMapper.insertCsArea(csArea);
     }

     @RequestMapping(value = "/qdtxModifyDmArea",method = RequestMethod.POST)
     public Integer qdtxModifyDmArea(@RequestBody CsArea csArea)throws Exception{
        csArea.setUpdatedTime(new Date());
        return csAreaMapper.updateCsArea(csArea);
     }
}
